//
//  XLSHAUtils.h
//  XLCryptoTool
//
//  Created by ilongge on 2022/8/16.
//

#import <Foundation/Foundation.h>
#include <CommonCrypto/CommonCrypto.h>

typedef NS_ENUM(NSInteger, XL_SHA_Key_Mode) {
    /// 在需要加密的字符串前后拼接key
    XL_SHA_Key_Mode_Salt_Front,
    /// 在需要加密的字符串前后拼接key
    XL_SHA_Key_Mode_Salt_Behind,
    /// key单独作为参数进行加密
    XL_SHA_Key_Mode_HMAC
};

typedef NS_ENUM(NSInteger, XL_SHA_Crypto_Mode) {
    XL_SHA_Crypto_1   = CC_SHA1_DIGEST_LENGTH,
    XL_SHA_Crypto_224 = CC_SHA224_DIGEST_LENGTH,
    XL_SHA_Crypto_256 = CC_SHA256_DIGEST_LENGTH,
    XL_SHA_Crypto_384 = CC_SHA384_DIGEST_LENGTH,
    XL_SHA_Crypto_512 = CC_SHA512_DIGEST_LENGTH
};

@interface XLSHAUtils : NSObject

+ (NSString *)shaCryptoWithMode:(XL_SHA_Crypto_Mode)cryptoMode
                     andKeyMode:(XL_SHA_Key_Mode)keyMode
                         andKey:(NSString *)encryptKey
                        andText:(NSString *)text;

@end

